UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uw8beJHQK58tHYO9Ceb2ANTnAj9y8/FN7/P9u4YPeXU='
WHERE
key_id = '252266b31b492f0bfe2d76dfe130c82807a1b8d6721fdbf59f8544e2a407dbd5'
AND (
token = 'uw8beJHQK58tHYO9Ceb2ANTnAj9y8/FN7/P9u4YPeXU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)