UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gLbKhYUkCwHzuwJjSXtY5U0ASkiUh3ZIisiYg6eaOEE='
WHERE
key_id = 'da205885fa80594d80fd772dd7c7c72df759bde245a3c993bb43b5bc8f1dea10'
AND (
token = 'gLbKhYUkCwHzuwJjSXtY5U0ASkiUh3ZIisiYg6eaOEE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)