UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dILlP99DvFPey1vt6aDKbL8TTxnxXkD4XuBT+cGkbu0='
WHERE
key_id = '66f9918edfe91c9ea556c03cefde92ddf711a77d11c81f81339fc67b88c492ff'
AND (
token = 'dILlP99DvFPey1vt6aDKbL8TTxnxXkD4XuBT+cGkbu0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)