UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd5sgN3H7RNPpknln0CiBhxw/eWHbaQqz8njUWh0kShk=' 
WHERE 
  key_id = '1bf5c0efe4f551c4436fe73435151a807e2c08d47cb6da531f318fae99a67ca1' 
  AND (
    token = 'd5sgN3H7RNPpknln0CiBhxw/eWHbaQqz8njUWh0kShk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027