UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1dmNj4e5tsuXw2bF9jKIbENmPjnk1deB83YGRRSxbzA='
WHERE
key_id = 'fe800019938ac3d9dda4512d802eb66c643f7e1cfd93b72480087f71ccb2a7b1'
AND (
token = '1dmNj4e5tsuXw2bF9jKIbENmPjnk1deB83YGRRSxbzA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)