UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm4+Lnv38a4j5SgVXtvumMHSpZolelfLz+7zjpcfz8p0='
WHERE
key_id = 'f739bc2d7091c139f20fe3975a01ae0b44ea39409b94678ac5708977a079f2b9'
AND (
token = 'm4+Lnv38a4j5SgVXtvumMHSpZolelfLz+7zjpcfz8p0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)