UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QavQ6YCfehW0ZpCLSwRquyl0mP1NF9nuypZiVS/ce2E='
WHERE
key_id = '3821d9bd65bd8ef1f9d0d6b0405274e49e2beab8388310816c278d69a4d78b3c'
AND (
token = 'QavQ6YCfehW0ZpCLSwRquyl0mP1NF9nuypZiVS/ce2E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)