UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UprQ/f87SyjtgVBmTDIyPlYDq1Nx/oQ4IAD1mw5yB3o=' 
WHERE 
  key_id = '10e4d8d37cade9eec08d305cdc1b7fe93613e89cb304c5fc2e7b9d717cac2857' 
  AND (
    token = 'UprQ/f87SyjtgVBmTDIyPlYDq1Nx/oQ4IAD1mw5yB3o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032