UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xqcw0FNcOcPtyVYzNNv5any/EXGgJLNgqJ+OOgNi+x8='
WHERE
key_id = 'afd5c0ce29309d3f66b3f80c553c2d89077794c807c7e54dd2c46ec9971cf5f7'
AND (
token = 'xqcw0FNcOcPtyVYzNNv5any/EXGgJLNgqJ+OOgNi+x8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)