UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8iRsM2+f6nlCLJ2pyJG6Myz+CKJjw0BTie9v3rqTRPE=' 
WHERE 
  key_id = '17a51a18ae009a40e5903f14d3f8f1a37825fe755f8cb23ae8288295733bc192' 
  AND (
    token = '8iRsM2+f6nlCLJ2pyJG6Myz+CKJjw0BTie9v3rqTRPE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031