UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qWBd4gt97RV02Gxiri2asN9HSARWqv3GuIw0AIeiw7Q='
WHERE
key_id = 'e849e78544a9c6154cafd8db16e997b0f5ec5d220955e8b57bd89dbba0d0dd1b'
AND (
token = 'qWBd4gt97RV02Gxiri2asN9HSARWqv3GuIw0AIeiw7Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)