UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fXyMiI04rTbEMA1po50fEp0vF85e983O0oqCdr4UHZs=' 
WHERE 
  key_id = '6b86b73d4ae643ecbb0fa94420e6f58762ddcca649b696db1cc31fdb89e8b139' 
  AND (
    token = 'fXyMiI04rTbEMA1po50fEp0vF85e983O0oqCdr4UHZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00087