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