UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '46Z3P+6XdwhAnsgdLd4Rp3hrON6zDpAxx9zYvqNc0Kw='
WHERE
key_id = '8fd5630c844638cee052972fc3928ffc0b67b8193458e5ec4d9c5bbb0c7166ea'
AND (
token = '46Z3P+6XdwhAnsgdLd4Rp3hrON6zDpAxx9zYvqNc0Kw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)