UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vKPYe3xwY0TdWDMJ+1PBuOIJvXxEbdU+JvdnIMQ3OOg=' 
WHERE 
  key_id = '81a9ea6b07a0549335804658c2fa758c4265c661fb58f1869f25b08ac346e63e' 
  AND (
    token = 'vKPYe3xwY0TdWDMJ+1PBuOIJvXxEbdU+JvdnIMQ3OOg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00080