UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd4ZkvbP8aJeeidjBmomvVre8Jyn5kpkB89LW6R/Sx6U='
WHERE
key_id = '946444ae7c479f80b36538e772b001e07f87101170f18ba85f8d35eb091b92aa'
AND (
token = 'd4ZkvbP8aJeeidjBmomvVre8Jyn5kpkB89LW6R/Sx6U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)