UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JUJ5L7CA1wd1FYP0ENOYgNgRyzs1hffnU709laIrOqw='
WHERE
key_id = 'd3810780aba1b371c322f06b3f54e2b98b916ec7a68ab5d7c92bb054e34deb15'
AND (
token = 'JUJ5L7CA1wd1FYP0ENOYgNgRyzs1hffnU709laIrOqw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)