UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xJiBMBNbU/2qRudWrFHH2QiZaOWJKMXRni8+++w7GcE=' 
WHERE 
  key_id = '37f71de8a01860e50397daa00fb74099d36d748ed79410d8bd71230c1e3ffe70' 
  AND (
    token = 'xJiBMBNbU/2qRudWrFHH2QiZaOWJKMXRni8+++w7GcE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030