UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XHfGgrqbJfvk/CXG4D16s9m/adypcGgxPGponwIyK40='
WHERE
key_id = '822b9e0bbde2fbebb93347f016febbb1f92709a1aae7fcefa5553a5cd6e26568'
AND (
token = 'XHfGgrqbJfvk/CXG4D16s9m/adypcGgxPGponwIyK40='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)