UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Yt05lFlHhOn1INWZnvPlnSowS4KOwnBVfny/vHAroDA='
WHERE
key_id = 'ce20a9739840507c431cb58c4ef2e2ad5d5033e5d4b7c4717eecd2e35e3944de'
AND (
token = 'Yt05lFlHhOn1INWZnvPlnSowS4KOwnBVfny/vHAroDA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)