UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j9tSZf4tX4ifQga+tyqlIT0cK33lglALgxP9h3RPxjA='
WHERE
key_id = 'b2473b1bf5c030f775b975fb6862f840ee81ee76a3a388fd3e6a4715fa818a3a'
AND (
token = 'j9tSZf4tX4ifQga+tyqlIT0cK33lglALgxP9h3RPxjA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)