UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6uXsZXnwOjwns4nQCCZwYG3QvhdROV1cTetagrUova8='
WHERE
key_id = '3bf423b38dfeab96c5f3fc896676f44f140f84321aa1b1552370848d30857a4d'
AND (
token = '6uXsZXnwOjwns4nQCCZwYG3QvhdROV1cTetagrUova8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)