UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cjkdrYWZi1F8+vmcEZBeSF2LvtsxHVc2TctsHnGEcGQ=' 
WHERE 
  key_id = '519ac03880deb3d0d9b15a3304a9a64b54b85d76788e011267f48d9319beef77' 
  AND (
    token = 'cjkdrYWZi1F8+vmcEZBeSF2LvtsxHVc2TctsHnGEcGQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036