UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CBSNQtUdyzvnxCV6CCkm+kGds9G++zSOyGHddaTKRxc='
WHERE
key_id = '66ca02ad209e769a6e03a4dd55f7aea91574066b7ad1d540ecd930435f4b61cc'
AND (
token = 'CBSNQtUdyzvnxCV6CCkm+kGds9G++zSOyGHddaTKRxc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)