UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aTAIHWjeAujoNSlASXsh9IioPi2kecCf8ATPpJAErSk=' 
WHERE 
  key_id = 'f0c73dc8a968f3c7faf8cbf4694e70ce2f5332b46181c3a5fbe1ca56f730ed05' 
  AND (
    token = 'aTAIHWjeAujoNSlASXsh9IioPi2kecCf8ATPpJAErSk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040