UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qjaweM0VpXvLKKXxk0TSAgmnK2fmOlM1fnejb/dbeYk='
WHERE
key_id = '8f8da80df340d5ba7bcdc1a4b1a11517b7309412d5a6f31f41804b6a92b23b26'
AND (
token = 'qjaweM0VpXvLKKXxk0TSAgmnK2fmOlM1fnejb/dbeYk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)