UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D07ws7QtGbrTB6aju1H+ahZBzjqdsJu+ZomeML91Koo='
WHERE
key_id = '5ff6aec163428a4b27474b25aa5d605fd98bc015d14e963e1a708b7049fb7d73'
AND (
token = 'D07ws7QtGbrTB6aju1H+ahZBzjqdsJu+ZomeML91Koo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)