UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fQwHqz0iItBiG0U5JE8orKBGcrpOljwZyK21pm5qmZA='
WHERE
key_id = '553c06f2898b7c23f25e399822afc13c5461b564db6e9657d11f6b1c9741c015'
AND (
token = 'fQwHqz0iItBiG0U5JE8orKBGcrpOljwZyK21pm5qmZA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)