UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N6KXgSq+b1eb1vt2usv4AHbKEYtePmj4QE0RJD7Ki7Y='
WHERE
key_id = '1547d31b9c79439741400e90119c51ac2eebe4d024ce6d9e979f43bcf417af3e'
AND (
token = 'N6KXgSq+b1eb1vt2usv4AHbKEYtePmj4QE0RJD7Ki7Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)