UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EgqvphW0gKmDvEHkP3W7axbOFXxhduaBj2FTlZcE03o=' 
WHERE 
  key_id = '9ba53b0636a4306773fdec2ea794b2eb68c036399b2eb835536b40db35f431f5' 
  AND (
    token = 'EgqvphW0gKmDvEHkP3W7axbOFXxhduaBj2FTlZcE03o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040