UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iZyHRZNi5XX1OPI8OSO9kO7yA7TwvvPNPl14e/fT0y4='
WHERE
key_id = '8e57bff0ccebb37a0d97126eb9d6781504f78012564111987ca70db04f3b13a7'
AND (
token = 'iZyHRZNi5XX1OPI8OSO9kO7yA7TwvvPNPl14e/fT0y4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)