UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W6Y2v1ciBytaHLj+cQROL2PpLxM/7kr9gBylEEMuuEo=' 
WHERE 
  key_id = '897ac64831b29c1543af4433c2197b785d9b0476477d8050f692866e9b613725' 
  AND (
    token = 'W6Y2v1ciBytaHLj+cQROL2PpLxM/7kr9gBylEEMuuEo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016