UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nFN7KL1aFCPVffN4oUE+5nb/LHFoiZ5iOt2H1g9Z3QU=' 
WHERE 
  key_id = '59903800a42eb0f700f332cf9ceca987b4e2147891712a9f486ba414e2632b07' 
  AND (
    token = 'nFN7KL1aFCPVffN4oUE+5nb/LHFoiZ5iOt2H1g9Z3QU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032