UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gqr+tPwouc6wNuoM023EcgyhKDEuJsLJxoyy/+Gk9Lo=' 
WHERE 
  key_id = '2022c34e6e1e7f8eecbfc7a4df9982ff1cc2bd3d8aa71912d097261aa1f70733' 
  AND (
    token = 'Gqr+tPwouc6wNuoM023EcgyhKDEuJsLJxoyy/+Gk9Lo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021