UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vpOJVMxm3uMR1+zhTk2pTq9w0n7lPCRrecnU8dpVt00='
WHERE
key_id = 'ba589ff1c63b9ab47e544e3fd474954648a89c6e9cf7d0c01d470efe0ea2a48e'
AND (
token = 'vpOJVMxm3uMR1+zhTk2pTq9w0n7lPCRrecnU8dpVt00='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)