UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TpKNio/JTO5CyUtF8iCTvTy/2wsgSx9Wiqz/KLi21Ws='
WHERE
key_id = 'bbb18ef347b87d3643f46a2e06aa14294e5370179d15efd4a0029f02a789a299'
AND (
token = 'TpKNio/JTO5CyUtF8iCTvTy/2wsgSx9Wiqz/KLi21Ws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)