UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2L5lkl6e1pVElWYbAOsnRBjKjFw8mjAUelnaDQqVt8I=' 
WHERE 
  key_id = '5c40879681e3f05b34e5fc654d1b994150cd8827ed1976c04a5039676358fb07' 
  AND (
    token = '2L5lkl6e1pVElWYbAOsnRBjKjFw8mjAUelnaDQqVt8I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027