UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wqqHedqOtSgMEZcNcLIDBAsAC7b1vpWeiEwlu65Jncc='
WHERE
key_id = '9fe938bef5cb2f63e82aaed209d59012f5a0e9ce8352f611ae09c2965e868fd9'
AND (
token = 'wqqHedqOtSgMEZcNcLIDBAsAC7b1vpWeiEwlu65Jncc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)