UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p9tFwuDUPFMnkqPnfZj7Gw+ybm5oa9nfdBufIng2vL4='
WHERE
key_id = 'c97b066a8de85321abe1bf1171eaffada2c8643b1ea32df5a84e41feaf01cc0e'
AND (
token = 'p9tFwuDUPFMnkqPnfZj7Gw+ybm5oa9nfdBufIng2vL4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)