UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B9gA+jS7CxtDDfheC3Dwf8PFMPrlRizOMReILeiJsAE=' 
WHERE 
  key_id = '45947c95ff22ed7853faaef16ca46fc350966cc046e3e9cf35fd26b1a664252c' 
  AND (
    token = 'B9gA+jS7CxtDDfheC3Dwf8PFMPrlRizOMReILeiJsAE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025