UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AW17PodRQXuTAFMHMiJ37AiKtM666lB+Wq+I+r6S6P0='
WHERE
key_id = '2cba797f07eb522961c5ad6fcf5a6e2dc999b8231552104e2eb30e51e7b2ae66'
AND (
token = 'AW17PodRQXuTAFMHMiJ37AiKtM666lB+Wq+I+r6S6P0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)