UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2oYAAmFj1dwWO2b0Bq7PZ5AXpSPy/r2uQT6nxHwy9zU=' 
WHERE 
  key_id = 'c04824cf8f105a1719329dde67d114a7a515e12447c32c8f83fcff85dd440205' 
  AND (
    token = '2oYAAmFj1dwWO2b0Bq7PZ5AXpSPy/r2uQT6nxHwy9zU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041