UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oX+vvl266InLeo+PBajXVhGRxUxYfqxARL0Wqo6Co8U='
WHERE
key_id = '24526c7b56ee52126b4df656a8d512c2557ffeca80f24432b64c6e6300b77c52'
AND (
token = 'oX+vvl266InLeo+PBajXVhGRxUxYfqxARL0Wqo6Co8U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)