UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FpiuMIlUFEd3XQZcHkw1l7SxzA1DOg4zbjvwg9p8B64=' 
WHERE 
  key_id = '7932ba68d4aa57b541f7acce29e46b685b0509c2e754accc12099400c56135f5' 
  AND (
    token = 'FpiuMIlUFEd3XQZcHkw1l7SxzA1DOg4zbjvwg9p8B64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022