UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8bLh8aZLvVSKtp9DnccNtd0v7Wmf0Wkf3tEKSWDokP4='
WHERE
key_id = 'ecd68e7e70a46ac03f2a001c84b77b36d16e4a3bbfa8842ce2adb72086a484e2'
AND (
token = '8bLh8aZLvVSKtp9DnccNtd0v7Wmf0Wkf3tEKSWDokP4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)