UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NHsoNb2eXAp7rAaxBB1q1OvyDsP59Bi7bPhm852ID68=' 
WHERE 
  key_id = '8f7ef56a36e587ac2cfa29a0ac33d98a0599c8fcc0aea2e919fbe6e7a05b55ad' 
  AND (
    token = 'NHsoNb2eXAp7rAaxBB1q1OvyDsP59Bi7bPhm852ID68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020