UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dwg7lWOK/Hr38wLBMTtaXGRhLA6MyZqEjis5wsfc0Zs=' 
WHERE 
  key_id = 'cfa27fd10cfe6e242efd1f8462e57b5216c15004668bee60a012e8cf3222e728' 
  AND (
    token = 'dwg7lWOK/Hr38wLBMTtaXGRhLA6MyZqEjis5wsfc0Zs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036