UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wKTfeyHQ2X3Jk4YcqBiBVF3YMK6tL0ysNZfYPK2ePdc='
WHERE
key_id = '333509784ff41a9f4dc5d14f81a65f1b33d3929d8b8f8100ae9aa9982f5a964b'
AND (
token = 'wKTfeyHQ2X3Jk4YcqBiBVF3YMK6tL0ysNZfYPK2ePdc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)