UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dxJeMV4zYYFoUQ+UCyYH3jzJM3+A6iqBy5l3OSdpzmk=' 
WHERE 
  key_id = 'd27ca0a786b8f3fba3340c5e3294f39f947bdc4e71322e5ea5c5b2b22347fa51' 
  AND (
    token = 'dxJeMV4zYYFoUQ+UCyYH3jzJM3+A6iqBy5l3OSdpzmk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026