UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hwR64Lr6/VlJ2TrXPdBgSkBFbd6ZyCd3e/EMneqw8wY=' 
WHERE 
  key_id = '73685aa03422ac8d5fd5ed6f6b7600a622fcdbcf5fae385aadc0c9564ff9efee' 
  AND (
    token = 'hwR64Lr6/VlJ2TrXPdBgSkBFbd6ZyCd3e/EMneqw8wY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032