UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1SAVf+D5IqPBn4WfJpci5jT7ESql/SvE9q0Sx/kooWE='
WHERE
key_id = 'ba88c17151a73cd465833a91cd6850146df324290996a794434229c7063647d2'
AND (
token = '1SAVf+D5IqPBn4WfJpci5jT7ESql/SvE9q0Sx/kooWE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)