UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XGfJvBwJQMiUhIlgQ3bLrFvcLRq3M/s9BXCYL+JbmfY=' 
WHERE 
  key_id = 'c5830636fd68131eec1836753cf2652c5ac55307f0199972ec3e6059d84b7647' 
  AND (
    token = 'XGfJvBwJQMiUhIlgQ3bLrFvcLRq3M/s9BXCYL+JbmfY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042