UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3qhviwuCc+aPPpOwdbB2brnE+AlOE6ZqMP4mhARyEqE='
WHERE
key_id = '6493cef92d255f470020e7af0d1e3a2622f46bf696057f92fb0d544e27e3bf57'
AND (
token = '3qhviwuCc+aPPpOwdbB2brnE+AlOE6ZqMP4mhARyEqE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)