UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ToQkOav7pnCFPtT7Q9bvjzH6YPYuPTFWp/UxBZjBJL8='
WHERE
key_id = '978622bf83b44c8592b1fcdd02ca2f93420f1d34c8fea49704133d9eb1d9f87f'
AND (
token = 'ToQkOav7pnCFPtT7Q9bvjzH6YPYuPTFWp/UxBZjBJL8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)