UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mVtNOPKJuasdmfS1HuQt6Ut2DoDaLCuEwB4LO4FWkGY=' 
WHERE 
  key_id = '9381103d2a9b93243052937499f3fc924095a1988b9765ddae7e14269eb1e9ef' 
  AND (
    token = 'mVtNOPKJuasdmfS1HuQt6Ut2DoDaLCuEwB4LO4FWkGY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030