UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YTxX+CGM51kAKoG0nJwG8H3EQQN4snRwFQtD4NCnSHU='
WHERE
key_id = '65aed9719d441f376e060fd2c8ca458cf3845a9f229c1eace077f246f7faeb03'
AND (
token = 'YTxX+CGM51kAKoG0nJwG8H3EQQN4snRwFQtD4NCnSHU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)