UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QfTwceLHFMzqKOnS2ynHcuAcFsH6cuQxYkLsnVmaM8s='
WHERE
key_id = '8d7bc123fd96074e1f7da1f1182d61d2e033c970b1f2e925bc2f215a965c34c5'
AND (
token = 'QfTwceLHFMzqKOnS2ynHcuAcFsH6cuQxYkLsnVmaM8s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)