UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nw3/r0lmcAZGzequLnOgapm/iU4AF6unYc6qWl2VeDY=' 
WHERE 
  key_id = '8e3f659d988e13b680088c9157efc0293dbe1794e1a9c3c766588b86cb081675' 
  AND (
    token = 'nw3/r0lmcAZGzequLnOgapm/iU4AF6unYc6qWl2VeDY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024