UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vLFjdvVbe19I2wh6QvHixtS4doPkdRzgDdQ1jELUpwk=' 
WHERE 
  key_id = '313c9060118253c05e90cc754e9e90001ef191681dbcc030846e67fd327538e6' 
  AND (
    token = 'vLFjdvVbe19I2wh6QvHixtS4doPkdRzgDdQ1jELUpwk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031